from changer.eschanger import ElasticSearchChanger


class WechatKOLClaimChanger(ElasticSearchChanger):
    def __init__(self, es, index, doc_type):
        super(WechatKOLClaimChanger, self).__init__(es, index, doc_type)

    def _build_data(self, args):
        id_ = args.get('biz_code')
        if id_ is None:
            return {"message": "biz_code is needed"}

        data = args.get('data')
        if not data:
            data = {}
        data['biz_code'] = id_
        return id_, data
